cmake_minimum_required(VERSION 3.5)

project(echo_server_v1)

# # 设置编译选项
# include(CheckCCompilerFlag)
# CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILE_SUPPORTS_CXX11)

# if(COMPILER_SUPPORTS_CXX11)
#     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# else()
#     message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
# endif()

# 方法二：直接设置CMAKE_CXX_STARDARD
# set(CMAKE_CXX_STANDARD 11)

if(CMAKE_COMPILER_IS_GNUCXX)
    add_compile_options(-std=c++11)
    message("using c++11 for compiling!")
endif()

add_compile_options(-g)
message("using -g for debug!")
add_compile_options(-Wall)
message("using -Wall for warning!")

add_executable(${PROJECT_NAME} 
    Acceptor.cc 
    InetAddress.cc 
    Socket.cc 
    SocketIO.cc 
    TcpConnection.cc 
    server.cc
)